<style lang="scss" scoped>
.forget1 {
  width: 100%;
  height: 100vh;
  background-image: url("@/images/bg/login_bg.png");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  .forget1-item {
    width: 300px;
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
  }
}
</style>

<template>
  <div class="forget1">
    <van-nav-bar
      title="忘记密码"
      left-arrow
      @click-left="router.back()"
      style="background-color: #0091ff; width: 100%"
    />
    <div class="forget1-item">
      <el-form :model="formData">
        <el-form-item prop="pwd1">
          <el-input v-model="formData.pwd1" show-password placeholder="请输入新密码"></el-input>
        </el-form-item>
        <el-form-item prop="pwd2">
          <el-input v-model="formData.pwd2" show-password placeholder="请确认新密码"></el-input>
        </el-form-item>
      </el-form>
    </div>
    <div>
      <van-button block style="width: 300px" @click="submit">完成</van-button>
    </div>
    <div></div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import { request } from '../../axios/request'
const router = useRouter()

// 表单数据
const formData = ref({
  pwd1: '',
  pwd2: ''
})

// 完成修改
const submit = () => {
  if (formData.value.pwd1 === formData.value.pwd2) {
    ElMessage.success('修改成功')
    router.push('/login')
  } else {
    ElMessage.error('两次密码不一致')
  }
}
</script>   